<template>
  <el-dialog :visible.sync="button.dialogVisible" width="30%">
    <div class="myDialog">
      <p class="myDialog-title">{{ button.myDialogTitle }}</p>
      <div class="myDialog-info">
        <div
          class="myDialog-info-template"
          v-for="(ele, i) in button.myDialog"
          :key="i"
        >
          <p class="myDialog-info-template-first">{{ ele.title }}</p>
          <el-input
            v-if="ele.type == 'input'"
            v-model="ele.value"
            :placeholder="'请输入' + ele.title"
          ></el-input>
          <el-date-picker
            v-if="ele.type == 'date'"
            value-format="yyyy年MM月dd日"
            v-model="ele.value"
            type="date"
            :placeholder="'请选择' + ele.title"
          ></el-date-picker>
          <div v-if="ele.type == 'radio'">
            <el-radio
              v-for="(_ele, _i) in ele.valueData"
              :key="_i"
              v-model="ele.value"
              :label="_ele"
              >{{ _ele }}</el-radio
            >
          </div>
        </div>
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button @click="button.dialogVisible = false">取 消</el-button>
        <el-button type="primary" @click="button.confirm">确 定</el-button>
      </span>
    </div>
  </el-dialog>
</template>

<script>
export default {
  data() {
    return {};
  },
  props: {
    button: Object,
  },
};
</script>

<style lang='scss' scoped>
.myDialog {
  .dialog-footer {
    .el-button {
      margin-right: 0.2rem;
    }
    margin-top: 0.2rem;
    display: flex;
    flex-direction: row-reverse;
  }
  &-info-template {
    div {
      display: flex;
      width: 80%;
    }
    &-first {
      width: 40%;
      text-align: left;
    }
    display: flex;
    justify-content: space-between;
    white-space: nowrap;
    align-items: center;
    padding: 0 0.2rem;
    background: #f5f5f5;
    margin-top: 0.2rem;
  }
  &-title {
    background: #006ab4;
    color: #fff;
    text-align: left;
    padding: 0.1rem 0.2rem;
  }
  background: #f4f4f4;
  padding-bottom: 0.2rem;
  &-info {
    max-height: 60vh;
    overflow-y: scroll;
  }
}
</style>